﻿<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
                    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
                    xmlns:params="http://schemas.codeplex.com/elysium/params">
    <ResourceDictionary.MergedDictionaries>
        <ResourceDictionary Source="/Elysium;component/Themes/Generic.xaml"/>
        <ResourceDictionary Source="/Framework.UI;component/Themes/WPF/Base/FocusVisualStyle.xaml"/>
    </ResourceDictionary.MergedDictionaries>

    <Style x:Key="DefaultButtonStyle" BasedOn="{StaticResource {x:Type Button}}" TargetType="{x:Type Button}">
        <Setter Property="Background" Value="{StaticResource AccentBrush}"/>
        <Setter Property="BorderBrush" Value="{StaticResource AccentBrush}"/>
        <Setter Property="FocusVisualStyle" Value="{StaticResource {x:Static SystemParameters.FocusVisualStyleKey}}"/>
    </Style>

    <Style x:Key="HyperlinkButtonStyle" TargetType="{x:Type Button}">
        <Setter Property="Background" Value="{StaticResource TransparentBrush}"/>
        <Setter Property="BorderBrush" Value="{StaticResource AccentBrush}"/>
        <Setter Property="BorderThickness" Value="0, 0, 0, 3"/>
        <Setter Property="Cursor" Value="Hand"/>
        <Setter Property="FocusVisualStyle" Value="{StaticResource {x:Static SystemParameters.FocusVisualStyleKey}}"/>
        <Setter Property="HorizontalContentAlignment" Value="Left"/>
        <Setter Property="VerticalContentAlignment" Value="Center"/>
        <Setter Property="FontSize" Value="{Binding RelativeSource={RelativeSource Self}, Path=(params:General.HeaderFontSize)}"/>
        <Setter Property="FontStretch" Value="Medium"/>
        <Setter Property="FontStyle" Value="Normal"/>
        <Setter Property="FontWeight" Value="Normal"/>
        <Setter Property="TextOptions.TextFormattingMode" Value="Display"/>
        <Setter Property="TextOptions.TextRenderingMode" Value="ClearType"/>
        <Setter Property="RenderOptions.ClearTypeHint" Value="Enabled"/>
        <Setter Property="Focusable" Value="True"/>
        <Setter Property="Foreground" Value="{StaticResource ForegroundBrush}"/>
        <Setter Property="OverridesDefaultStyle" Value="True"/>
        <Setter Property="Padding" Value="0"/>
        <Setter Property="SnapsToDevicePixels" Value="True"/>
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="{x:Type Button}">
                    <ControlTemplate.Resources>
                        <Storyboard x:Key="MouseEnter">
                            <DoubleAnimation Duration="00:00:00.3"
                                             Storyboard.TargetName="Border"
                                             Storyboard.TargetProperty="Opacity"
                                             To="1"/>
                        </Storyboard>
                        <Storyboard x:Key="MouseLeave">
                            <DoubleAnimation Duration="00:00:00.3"
                                             Storyboard.TargetName="Border"
                                             Storyboard.TargetProperty="Opacity"/>
                        </Storyboard>
                    </ControlTemplate.Resources>
                    <Grid>
                        <Border x:Name="Border"
                                BorderBrush="{TemplateBinding BorderBrush}"
                                BorderThickness="{TemplateBinding BorderThickness}"
                                Opacity="0"
                                SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}"/>
                        <Border Background="{TemplateBinding Background}"
                                TextBlock.Foreground="{TemplateBinding Foreground}"
                                TextBlock.FontFamily="{TemplateBinding FontFamily}"
                                TextBlock.FontSize="{TemplateBinding FontSize}"
                                TextBlock.FontStretch="{TemplateBinding FontStretch}"
                                TextBlock.FontStyle="{TemplateBinding FontStyle}"
                                TextBlock.FontWeight="{TemplateBinding FontWeight}"
                                TextOptions.TextFormattingMode="{TemplateBinding TextOptions.TextFormattingMode}"
                                TextOptions.TextRenderingMode="{TemplateBinding TextOptions.TextRenderingMode}"
                                RenderOptions.ClearTypeHint="{TemplateBinding RenderOptions.ClearTypeHint}"
                                SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}">
                            <ContentPresenter Margin="{TemplateBinding Padding}"
                                              HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}"
                                              VerticalAlignment="{TemplateBinding VerticalContentAlignment}"
                                              RecognizesAccessKey="True"/>
                        </Border>
                    </Grid>
                    <ControlTemplate.Triggers>
                        <Trigger Property="IsDefault" Value="True">
                            <Setter Property="FontWeight" Value="Bold"/>
                        </Trigger>
                        <Trigger Property="IsEnabled" Value="False">
                            <Setter Property="Foreground" Value="{StaticResource DisabledBrush}"/>
                        </Trigger>
                        <Trigger Property="IsMouseOver" Value="True">
                            <Trigger.EnterActions>
                                <StopStoryboard BeginStoryboardName="MouseLeave"/>
                                <BeginStoryboard x:Name="MouseEnter" Storyboard="{StaticResource MouseEnter}"/>
                            </Trigger.EnterActions>
                            <Trigger.ExitActions>
                                <StopStoryboard BeginStoryboardName="MouseEnter"/>
                                <BeginStoryboard x:Name="MouseLeave" Storyboard="{StaticResource MouseLeave}"/>
                            </Trigger.ExitActions>
                        </Trigger>
                    </ControlTemplate.Triggers>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>
    <Style x:Key="NormalTextHyperlinkButtonStyle" BasedOn="{StaticResource HyperlinkButtonStyle}" TargetType="{x:Type Button}">
        <Setter Property="FontSize" Value="{Binding RelativeSource={RelativeSource Self}, Path=(params:General.TextFontSize)}"/>
    </Style>

</ResourceDictionary>